from machine import reset
from time import sleep
from Gateway import Gateway

def parsing(obj: Gateway, pack: dict):
    """
    该方法的参数不要随意修改
    obj:是Gateway对象
    pack:是接收到服务器回应的数据包
    """
    if pack["data"] and obj.devices.get("jsj_button"):
        d = obj.devices["jsj_button"]
        d.value(not d.value())
        sleep(0.1)
        d.value(not d.value())
        return True
    else:
        return False


